home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50b Issue 142 (CD142b) (August 1998).iso / handson / Java / JBAdventure / Room.java < prev    next >
Encoding:
Java Source  |  1998-01-23  |  1.1 KB  |  61 lines

  1. public class Room extends ThingHolder
  2. {       
  3.     // A Room is a ThingHolder (i.e. it can contain other Things)
  4.     // which also has exits represented by integers indicating
  5.     // the map index of the Room to which that exit leads
  6.     
  7.     private int n,s,w,e;
  8.    
  9.     Room( String aName,
  10.     // constructor
  11.           String aDescription,
  12.           int    an,
  13.           int    as,
  14.           int    aw,
  15.           int    ae    
  16.         ) 
  17.         {
  18.             super( aName, aDescription ); // init super class
  19.             this.n = an;
  20.             this.s = as;
  21.             this.w = aw;
  22.             this.e = ae;
  23.         }        
  24.         
  25.     // access methods
  26.     // n
  27.     int getn() {
  28.         return n;
  29.     }
  30.     
  31.     void setn(int an) {
  32.         this.n = an;
  33.     }  
  34.  
  35.     // s
  36.     int gets() {
  37.         return s;
  38.     }
  39.  
  40.     void sets(int as) {
  41.         this.s = as;
  42.     }  
  43.     
  44.     // e
  45.     int gete() {
  46.         return e;
  47.     }
  48.  
  49.     void sete(int ae) {
  50.         this.e = ae;
  51.     }  
  52.     
  53.     // w
  54.     int getw() {
  55.         return w;
  56.     }
  57.  
  58.     void setw(int aw) {
  59.         this.w = aw;
  60.     }  
  61. }